<?php
try{
    //建立连接
    include __DIR__.'/../includes/DatabaseConnection.php';

    $sql = 'DELETE FROM `joke` WHERE `id` = :id';
    $stmt = $pdo->prepare($sql);
    $stmt->bindValue(':id',$_POST['id']);
    $stmt->execute();

    header('location:jokes.php');
}catch(PDOException $e){
    $output = "不能连接到数据库".$e->getMessage().' in '.$e->getFile().':'.$e->getLine();
}
include __DIR__.'/../templates/layout.html.php';